<?php 
function smarty_function_javascript($params, $smarty)
{
	$js_files = $smarty->getTemplateVars('js_files'); 
	
	$block = null;
			
	if(isset($params['exclude']))
	{
		if(!empty($params['exclude']))
		{
			$exclude = explode(";", $params['exclude']);
			
			foreach($exclude as $exlude_js)
			{
				//$r = array_search($exlude_js, $js_files);
				
				//var_dump($r);
				
				foreach($js_files as $include_key => $include_js)
				{
					//var_dump($include_js . $exlude_js);
					$_var = strstr($include_js, $exlude_js);
					//var_dump($_var);
					if($_var !== false)
					{
						unset($js_files[$include_key]);
					}
				}
			}
		}
	}
	
	
	//print_r($exclude);
	
	//print_r($js_files);
	
	foreach($js_files as $key => $item)
	{
		$block.= "<script src=\"$item\" type=\"text/javascript\"></script>\n";
	}
	
	return $block;
}